﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using MockupDesigner.Editors.TextEditors;
using System.Windows;
using MockupDesigner.AppItems;
using System.ComponentModel;

namespace MockupDesigner.Items
{
    [TabControlEditor]
    public class TabControlItem : ContentControlContainerItem
    {
        public TabControlItem()
        {
            List<ContentControl> list = new List<ContentControl>();
            TabItem ti = new TabItem() { Content = "Item1" };
            ti.IsSelected = true;
            list.Add(ti);
            ti = new TabItem() { Content = "Item2" };
            list.Add(ti);
            ItemsSource = list.ToArray();
        }

        public override System.Windows.Size GetPreferredSize()
        {
            return new Size(this.ActualWidth, 70);
        }

        protected override void SetNewSelectedIndex(int oldIndex)
        {
            (ItemsSource.ElementAt(oldIndex) as TabItem).IsSelected = false;
            (ItemsSource.ElementAt(SelectedIndex) as TabItem).IsSelected = true;
        }
    }
}
